#include "line.h"
#include <iostream>
using std::cout;
using std::endl;


class Line::LineImpl{
public:
    LineImpl(int x1,int y1,int x2,int y2)
    :_pt1(x1,y1)
    ,_pt2(x2,y2)
    {

    }

    void printline(){
        _pt1.print();
        cout << "------>";
        _pt2.print();
        cout <<endl;
    }
private:
    class Point{
    public:
        Point(int x, int y)
        :_x(x)
        ,_y(y)
        {

        }
        void print(){
            cout << "(" << _x <<"," << _y << ")";
        }
    private:
        int _x,_y;
    };
    Point _pt1;
    Point _pt2;
};

Line::Line(int x1,int y1,int x2,int y2)
:_impl(new LineImpl(x1,y1,x2,y2))
{
}

Line::~Line(){
    if(_impl){
        delete _impl;
        _impl = nullptr;
    }
}

void Line::printLine(){
    _impl -> printline();
}
